package org.ust.extraction;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;

public class UncompressUtil
{

	/**
	 * @param folderContainingJars
	 * @param jarFileName
	 */
	public static File uncompressJarFile ( String folderContainingJars ,
			String jarFileName )
	{
		File uncompressed = null;
		File targetJarFile = new File ( folderContainingJars + jarFileName );
		Uncompressor uncompressor = null;
		try
		{
			uncompressor = new Uncompressor ( targetJarFile );
			uncompressed = uncompressor.uncompress ( );
		}
		catch ( FileNotFoundException e )
		{
			e.printStackTrace ( );
		}
		catch ( NotZipFileException e )
		{
			e.printStackTrace ( );
		}
		catch ( IOException e )
		{
			e.printStackTrace ( );
		}
		return uncompressed;
	}

	/**
	 * @param folderContainingZips
	 * @param zipFileName
	 */
	public static File uncompressZipFile ( String folderContainingZips ,
			String zipFileName )
	{
		File uncompressed = null;
		File targetZipFile = new File ( folderContainingZips + zipFileName );
		Uncompressor uncompressor = null;
		try
		{
			uncompressor = new Uncompressor ( targetZipFile );
			uncompressor.uncompress ( );
		}
		catch ( FileNotFoundException e )
		{
			e.printStackTrace ( );
		}
		catch ( NotZipFileException e )
		{
			e.printStackTrace ( );
		}
		catch ( IOException e )
		{
			e.printStackTrace ( );
		}
		return uncompressed;
	}
}
